-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: poll many blocks #277
Conversation
} | ||
|
||
if failedCycles > maxFailedCycles { | ||
cp.logger.Fatal("the poller has reached the max failed cycles, exiting") | ||
} | ||
select { | ||
case <-time.After(cp.cfg.PollInterval): | ||
case <-ticker.C: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we use a ticker for long-running loops, as time.After
creates a new instance every iteration that needs to be garbage-collected
return cp.nextHeight | ||
} | ||
|
||
func (cp *ChainPoller) setNextHeight(height uint64) { | ||
cp.mu.Lock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we run the unit tests with -race, we have a race condition, need a mutex for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! Two comments:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
closes #264